<template>
  <div class="user-page">
    <user-card
      :is-detail="true"
      :data="user"
      @click="toPage('/pages/user/userInfo')"
    />
    <div class="user-page__body">
      <div
        v-for="item in features"
        :key="item.icon"
        class="cell-item"
        @click="toPage(item.url)"
      >
        <van-icon class="cell-item__icon" :name="item.icon" />
        <span class="cell-item__title">{{ item.label }}</span>
        <van-icon class="cell-item__arrow" name="arrow" />
      </div>
    </div>
  </div>
</template>

<script>
import UserCard from "./components/UserCard.vue";
import { Icon } from "vant";
import { mapGetters } from "vuex";
export default {
  components: {
    UserCard,
    [Icon.name]: Icon
  },
  data() {
    return {
      features: [
        {
          label: "评测记录",
          icon: "column",
          url: "/pages/exam/index"
        },
        {
          label: "居家自查",
          icon: "diamond",
          url: "/pages/examdetail/index"
        }
      ]
    };
  },
  computed: {
    ...mapGetters(["user"])
  }
};
</script>

<style lang="less">
@import "./index.less";
</style>
